<?php
namespace app\web\controller;

use controller\BasicWeb;
use Zxing\Reader;
use think\Request;
use service\InterfaceCode;
use app\common\model\BcnFeedbacks;

class Feedback extends BasicWeb
{
    protected $auth_type = 4;

    public function index()
    {
        $data = BcnFeedbacks::field('id,content,tel,created_time')->select()->toArray();
        return $this->success($data);
    }

    public function save(Request $request)
    {
        $content = $request->param('content','');
        $tel = $request->param('tel','');
        if(!$content || !$tel){
            $this->error(InterfaceCode::$app_error_code['PARAMETER_ERROR'], '参数错误');
        }
        $array['content'] = $content;
        $array['tel'] = $tel; 
        $success = BcnFeedbacks::create($array);
        if($success){
            return $this->success();
        }
    }
}